<div class="pageContent">
    <form method="post" action="${rc.getContextPath()}/manage/personnelConfirm/savePersonnelConfirm" class="pageForm required-validate" onsubmit="return validateCallback(this, _personnelConfirmAddAjaxDone)">
        <input type="hidden" name="navTabId" value="${navTabId!''}" />
        <div class="pageFormContent">
            <fieldset>
                <dl class="notnormal">
                    <dt><@label key='personnelCode.C,colon'>人员编号：</@label></dt>
                    <dd>
                        <input class="required look"  id="personnelLookup.personnelCode" name="personnelCode" type="text" postField="personnelCode" suggestFields="personnelCode,personnelName,workCenterCode,workCenterText" 
                        suggestUrl="${rc.getContextPath()}/manage/personnel/personnelSuggest" lookupGroup="personnelLookup" remote="${rc.getContextPath()}/manage/personnel/validatePersonnel" callback="_setshiftingWorkCenter" />
                        <a class="btnLook" href="${rc.getContextPath()}/manage/personnel/personnelLookUp?lookupType=radio" rel="personnel_dialog"   title="<@label key='select.C,personnelCode.C'>选择人员</@label>" lookupGroup="personnelLookup" ></a>
                    </dd>
                </dl>
                <dl>
                    <dt><@label key="personnelName.C,colon">姓名：</@label></dt>
                    <dd>
                        <input id="personnelLookup.personnelName"  name="personnelName" readonly="readonly" type="text"/>
                        <input name="workCenterCode" id="personnelLookup.workCenterCode"  type="hidden" />
                    </dd>
                </dl>

                <dl class="notnormal">
                    <dt><@label key='confirmTime.C,colon'>报工时间：</@label></label></dt>
                    <dd>
                        <input type="text" class="required date"  name="confirmDatetime" readonly  dateFmt="yyyy-MM-dd HH:mm:ss"/><a class="inputDateButton" href="javascript:;">选择</a>
                    </dd>
                </dl>
                <dl class="notnormal">
                    <dt><@label key="shiftingWorkCenter.C,colon">实际工作中心：</@label></dt>
                    <dd>
                    <input id="shiftingWorkCenterGrp.workCenterCode" class="required" name="shiftingWorkCenterCode" 
                	type="text"  suggestFields="workCenterCode,workCenterText" postField="workCenterCode" 
					suggestUrl="${rc.getContextPath()}/manage/workCenter/workCenterSuggest" 
					remote="${rc.getContextPath()}/manage/workCenter/validateWorkCenter" 
					lookupGroup="shiftingWorkCenterGrp" autocomplete="off"  value="${shiftingWorkCenterGrp.workCenterCode!''}"/>	
                    </dd>
                </dl>
                <dl class="notnormal">
                    <dt><@label key='materialCode.C,colon'>物料编码：</@label></dt>
                    <dd>
                        <input class="required look" id="materialLookup.materialCode" name="materialCode" type="text" postField="materialCode" suggestFields="materialCode,materialText" 
                        suggestUrl="${rc.getContextPath()}/manage/material/componentSuggest" lookupGroup="materialLookup" remote="${rc.getContextPath()}/manage/material/validateMaterial" warn="<@label key='materialCodeNotExists.M'>物料编号不存在</@label>"/>
                        <a class="btnLook" href="${rc.getContextPath()}/manage/material/componentLookUp?lookupType=radio" rel="materialLookup_dialog" title="<@label key='select.C,materialCode.C'>选择物料</@label>" lookupGroup="materialLookup" ></a>
                    </dd>
                </dl>
                <dl style="display:none">
                    <dt><@label key='materialText.C'>物料描述：</@label></dt>
                    <dd><input readonly id="materialLookup.materialText" name="materialText" /></dd>
                </dl>
                <dl>
                    <dt><@label key='quantity.C,colon'>数量</@label></dt>
                    <dd><input type="text" name="quantity" class="required number" min="1" maxlength="15"/></dd>
                </dl>
                <dl>
                    <dt><@label key='memo.C,colon'>备注</@label></dt>
                    <dd><input type="text" name="memo"  maxlength="200" /></dd>
                </dl>
                <dl>
                    <dd><span style="color:red" id="performanceMsgInfo"></span></dd>
                </dl>
            </fieldset>
        </div>
        <div class="formBar">
       		<div class="buttonActiveGrey">
       			<div class="buttonContent"><button  id="ClearLog" type="button"><@label key="ClearLog.B">清除日志</@label></button></div>
           	</div>
        <ul>
        	<li>
        		<div class="buttonActive"><div class="buttonContent"><button type="submit"><@label key="save.B">保存</@label></button></div></div>
        	</li>
            <li>
                <div class="buttonActiveGrey"><div class="buttonContent"><button type="button" class="close"><@label key="close.B">关闭</@label></button></div></div>
            </li>
        </ul>
       </div>
    </form>
    <table id="performanceLog" class="table border" width="160%" layoutH="220" style="overflow:scroll;">
        <thead>
           <tr>
                <th width="40"><@label key="serialNumber.C">序号</@label></th>
                <th width="100"><@label key='personnelCode.C'>人员编号</@label></th>
                <th width="100" ><@label key='personnelName.C'>姓名</@label></th>
                <th width="80"><@label key='quantity.C'>数量</@label></th>
                <th width="140"><@label key='confirmTime.C'>报工时间</@label></th>
                <th width="100"><@label key='materialCode.C'>物料编号</@label></th>
                <th width="100"><@label key='materialText.C'>物料描述</@label></th>
                <th width="100"><@label key="workCenter.C">工作中心：</@label></th>
                <th width="120"><@label key="shiftingWorkCenter.C">实际工作中心</@label></th>
                <th width="120"><@label key='memo.C'>备注</@label></th>
            </tr>

        </thead>
        <tbody id='tbody'>
        </tbody>
    </table>
</div>
<script type="text/javascript">
    var _saveCount = 0;
    var shiftPersonnelConfirmDialog = $.pdialog.getCurrent();
    function  _personnelConfirmAddAjaxDone(json) {
        DWZ.ajaxDone(json);
        if (json.statusCode == DWZ.statusCode.ok) {
            if (json.navTabId){
                navTab.reload(json.forwardUrl, {navTabId: json.navTabId});
            } 
            _saveCount ++;
            var data = json.data;
            if(!data || !data.id)
                return;
            var $tbody = $("#performanceLog .gridTbody", shiftPersonnelConfirmDialog).find("table tbody");
            var $tr = $("<tr/>");
            for(var i = 0; i < 10; i++) {
                 $tr.append('<td/>');
            }
            $("td:eq(0)", $tr).append(_saveCount);
            $("td:eq(1)", $tr).append(data.personnelCode);
            $("td:eq(2)", $tr).append(data.personnelName);
            $("td:eq(3)", $tr).append(data.quantity);
            $("td:eq(4)", $tr).append(new Date(parseInt(data.confirmDatetime)).formatDate("yyyy-MM-dd HH:mm:ss"));
            $("td:eq(5)", $tr).append(data.materialCode);
            $("td:eq(6)", $tr).append(data.materialText);
            $("td:eq(7)", $tr).append(data.workCentertext);
            $("td:eq(8)", $tr).append(data.shiftingWorkcenterText);
            $("td:eq(9)", $tr).append(data.memo);
            $tr.prependTo($tbody );
            $.jTableTool.initGridColumnWidth($tbody.parents('.grid:first'));
        }
    }
    function _setshiftingWorkCenter() {
    	//console.log($("#personnelLookup\\.workCenterCode",shiftPersonnelConfirmDialog));
    	var shiftingWorkCenter=$("#personnelLookup\\.workCenterCode",shiftPersonnelConfirmDialog).val();
    	$("#shiftingWorkCenterGrp\\.workCenterCode",shiftPersonnelConfirmDialog).val(shiftingWorkCenter);
    }
    $(function(){
    	$("#ClearLog",shiftPersonnelConfirmDialog).click(function() {
    		$("#performanceLog tbody").html("");
    		_saveCount=0;
    	});
    });
</script>